{extend name="admin/base" /}
{block name="resources"/}
<script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" type="text/css" href="ADMIN_CSS/wap_template.css">
<style>
.mlr15{
	margin:0;
}

.goodsRecommend{
	width:660px;
	display:inline-block;
	
}
.panel-heading{
	height:40px;
	line-height:40px;
	margin-top:15px;
	background:#F9F9F9;
	padding:0 15px;
	color:#00C0FF;
}
.handle{
	display:inline-block;
	background:#FB6B5B;
	padding:0 8px;
	font-size:12px;
	color:#fff;
	margin:7px;
	line-height:25px;
	float:right;
}
.td{
	width:20%;
	text-align:center;
}
.set-style{
	width:100%;
}
.set-style dl{
	width:100%;
	font-size: 0;
	/* line-height: 20px; */
	clear: both;
	padding: 0;
	margin: 0;
	border-bottom: dotted 1px #E6E6E6;
	overflow: hidden;
}
.set-style dl dt{
	font-size: 12px;
	line-height: 32px;
	vertical-align: top;
	letter-spacing: normal;
	word-spacing: normal;
	text-align: right;
	display: inline-block;
	width: 19%;
	padding: 10px 1% 10px 0;
	margin: 0;
	font-weight:normal;
}
.set-style dl dd{
	
	font-size: 12px;
	line-height: 32px;
	vertical-align: top;
	letter-spacing: normal;
	word-spacing: normal;
	display: inline-block;
	width: 78%;
	padding: 10px 0 10px 5px;
/*     border-left: 1px dotted #ccc; */
}
.borderclass{
	font-size: 12px;
	line-height: 32px;
	vertical-align: top;
	letter-spacing: normal;
	word-spacing: normal;
	display: inline-block;
	width: 78%;
	padding-left: 7px;
    border-left: 1px dotted #ccc;
}
.set-style dl dd input[type="text"]{
	font: 12px/20px Arial;
	color: #777;
	background-color: #FFF;
	vertical-align: top;
	display: inline-block;
	height:24px;
	line-height:24px;
	padding: 4px;
	border: 1px solid #CCC;
	outline: 0 none;
	width: 400px;
	margin:0;
}
.set-style dl dd textarea{
    font: 12px/20px Arial;
    color: #777;
    background-color: #FFF;
    vertical-align: top;
    display: inline-block;
    height: 60px;
    padding: 4px;
    border: solid 1px #CCC;
    outline: 0 none;
	width: 400px;
	margin:0;
}
.hint{
    font-size: 12px;
    line-height: 16px;
    color: #BBB;
    margin-top: 10px;
}
.set-style dl dd p img{
	border: medium none;
	vertical-align: middle;
}
.info{
	width:405px;
	color: #c09853;
    background-color: #fcf8e3;
    border-color: #faebcc;
	padding: 8px;
    border: 1px solid transparent;
    border-radius: 4px;
}
.alert-goods-info{
	padding:5px;
	width:80px;
	height:110px;
	background:#D9EDF7;
	border:1px solid #BCE8F1;
	float:left;
	margin-right:2px;
}
.alert-goods-info img{
	display:block;
	margin:20px auto 0 auto;
}
.goods-name{
	display:block;
	white-space:nowrap;
	overflow:hidden; 
	text-overflow:ellipsis;
	text-align:center;
	margin-top:3px;
}
.search-goods-info{
	padding:5px;
	width:80px;
	height:110px;
	border:1px dashed #ddd;
	float:left;
	margin:5px 5px 0 0;
	cursor:pointer;
}
.tip-box{
	width: 975px;
	line-height: 150px;
	text-align: center;
}

.table tr .td img{
	width:100px;
	display:inline-block;
}
.goods-logo-class{
	width:100%;
}
.goods-logo-class ul{
	overflow:hidden;
	margin: 0px;
}
.goods-logo-class ul li{
	float:left;	
	width:20%;
	cursor:pointer;
}
.imglogo{
	width:90%;
	margin:0 auto;
}
.app-template li{width:220px;}
</style>
{/block}
{block name="main"}
<div class="mb10 mlr15">
<!--        <div class="tiphelp-info"><strong>提示：</strong><br> -->
<!--             此公告在手机端首页显示。<br/> -->
<!--        </div> -->
</div>
<div class="set-style">
	<dl>
		<dt><span style="color:red;margin-right:10px;">*</span>用户通知:</dt>
		<dd class="borderclass">
			<textarea rows="2" id="notice_message" class="textarea w400" maxlength="50">{$info.notice_message}</textarea>
<!-- 			<p style="margin-top:-20px;"> -->
<!-- 				<br> <span style="color: orange;">此公告在手机端首页显示。</span> -->
<!-- 			</p> -->
			<p class="hint" style="display:none;color:red;">不可为空！</p>
		</dd>
	</dl>
	<dl>
		<dt>是否启用用户通知:</dt>
		<dd class="borderclass">
			<p>
					<input id="is_enable" type="checkbox" class="checkbox"  {if condition="$info.is_enable==1"} checked="checked"{/if}/>
			</p>
		</dd>
	</dl>
	<dl>
		<dt>首页商品分类显示:</dt>
		<dd class="borderclass">
			<p>
				<input id="is_category" type="checkbox" class="checkbox" {if condition="$lists['value']['is_category'] eq 1"}checked="checked"{/if} onchange="chagecategoryblock();"/>
			</p>
		</dd>
	</dl>
	<dl>
		<dt>首页商品促销版块显示:</dt>
		<dd class="borderclass">
			<p style="width:13%;float:left;">
				<input id="is_recommend" type="checkbox" class="checkbox" {if condition="$list['value']['is_recommend'] eq 1"}checked="checked"{/if} onchange="chageshowblock();"/>
			</p>
			<a href="javascript:void(0);" onclick="addBlock()" style="display:inline_block;width:75%;"><p class="addblockbutton" style="width:50%;float:left;color:#51A351;cursor: pointer;display:none;]">&nbsp;<i class="fa fa-plus-circle"></i>添加版块</p></a>
<!-- 		<a class="nscs-table-handle_green" href="javascript:void(0);" onclick="addBlock()"><i class="fa fa-plus-circle"></i>&nbsp;添加促销版块</a> -->
		</dd>
	</dl>
	<dl id="hideborder">
		<dt>&nbsp;</dt>
		<dd class="borderclass">
			<div class="goodsRecommend" id="showblock" style="display:none;">
				{notempty name="goods_recommend_class"}
				<form class="" id="block_list">		
					{foreach name="goods_recommend_class" item="v"}		
			             <header class="panel-heading">
			             	{$v['class_name']} 
			             	<a href="javascript:void(0);" onclick="delGoodsRecommendClass({$v['class_id']},this)" class="handle"><i class="fa fa-trash-o"></i>&nbsp; 删除 </a>   	
			               	<a href="javascript:void(0);" onclick="updateGoodsRecommendClass({$v['class_id']})" class="handle" style="background:#01B044;"><i class="fa fa-cog"></i>&nbsp; 编辑 </a>       	    	
			             </header>
			             <div class="goods-logo-class">
			             	<ul>
			             		{notempty name="v['goods_list']"}
			                    	{foreach name="v['goods_list']" item="vg"}
			             			<li >
			             				<img class="imglogo" src="__UPLOAD__/{$vg['picture_info']['pic_cover_small']}" alt="{$vg['goods_info']['goods_name']}" title="{$vg['goods_info']['goods_name']}"  style="border:1px dashed #e9e9e9;text-align:center;">
			             			</li>
			             		{/foreach}
			                    {else /}
			                    	<li>暂未选择商品</li>
			                   	{/notempty}
			             	</ul>
			             </div>          
			          {/foreach}
				</form>
				{/notempty}
			</div>
			<div class="goodsRecommend" id="add-goodsRecommend">
			</div>
		</dd>
	</dl>
	<div class="modal fade hide" id="data" style="width:800px;" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content" style="width:800px;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">促销商品推荐</h4>
            </div>
            <div class="modal-body" style="height:700px;overflow:auto;">
            	<div class="set-style">
            		<dl>
						<dt><span class="color-red">*</span>模块名称</dt>
						<dd>
							<input type="hidden" class="form-control" id="class_id" value="">
							<input type="text" class="form-control" id="class_name" value="" placeholder="请输入模块名称">
							<span class="error">请输入模块名称</span>
						</dd>
					</dl>
					<dl>
						<dt>排序</dt>
						<dd>
							<input type="text" class="form-control" id="sort" value="" onkeyup="this.value=this.value.replace(/\D/g,'')" placeholder="排序">
						</dd>
					</dl>
					<dl>
						<dt>已选商品</dt>
						<dd>
						<div class="info" >
		                  	<button type="button" class="close" data-dismiss="alert" style="margin-top:4px;">×</button>
		                  	<p>单击查询出的商品选中，双击已选择的可以删除，最多5个，保存后生效。</p>
		                </div>
		                </dd>
		                <dt></dt>
		                <dd>
		                	<div id="goods_list">
		                		
		                	</div>
		                </dd>
					</dl>
					<dl>
						<dt>选择要促销的商品:</dt>
						<dd></dd>
						<dt>选择分类</dt>	
						<dd>
<!-- 							<select id="category_id" name="account" class="form-control m-b"> -->
<!-- 								<option value="0">--请选择--</option> -->
<!-- 								{foreach name="category_list_1" item="vc1"} -->
<!-- 			           				<option value="{$vc1['category_id']}">{$vc1['category_name']}</option> -->
<!-- 			           			{/foreach} -->
<!-- 							</select>	 -->
							
							<select name="account" class="form-control m-b category_first" id="category_first_id" onchange="changeCategory(this, 1)" style="width:145px;height:34px;">
								<option value="0">商品分类一级</option>
								{volist name="category_list_1" id="vc1"}
									<option value="{$vc1['category_id']}">{$vc1['category_name']}</option>
								{/volist}
							</select>
							<select name="account" class="form-control m-b hide category_second" id="category_second_id" onchange="changeCategory(this, 2)" style="width:145px;height:34px;">
								<option value="0">商品分类二级</option>
							</select>
							<select name="account" class="form-control m-b hide category_three" id="category_three_id" onchange="changeCategory(this, 3)" style="width:145px;height:34px;">
								<option value="0">商品分类三级</option>
							</select>			
						</dd>
						<dt>商品名称</dt>	
						<dd>
							<input type="text" class="form-control" id="search_info" value="" placeholder="请输入商品名称">				
							<button type="button" class="btn btn-info"  onclick="search_goods()" style="display:inline-block;">搜索</button>
						</dd>
					</dl>
					<dl>
						<dt></dt>
						<dd id="search_goods_list">
						
						</dd>
					</dl>
            	</div>
            </div>
            <div class="modal-footer">
            	<button type="button" class="btn btn-info" onclick="save()" style="display:inline-block;">保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal" style="display:inline-block;">关闭</button>                
            </div>
        </div>
    </div>
</div>
	<dl>
		<dt>模板列表</dt>
		<dd class="borderclass">
			{if condition="$not_readable_count && $not_writable_count"}
				<div class="alert">
					<button type="button" class="close" data-dismiss="alert">&times;</button>
					<strong>警告,请检查以下文件是否可读可写！</strong>
					<div style="margin-top:5px;">
						
						{if condition="$not_readable_count"}
						<span>发现{$not_readable_count}个文件不可读！</span>
						<ul style="margin-bottom: 10px;">
							{foreach name="not_readable_list" item="not_readable"}
							<li>{$not_readable}</li>
							{/foreach}
							</ul>
						{/if}
						
						{if condition="$not_readable_count"}
						<span>发现{$not_writable_count}个文件不可写！</span>
						<ul>
							{foreach name="not_writeable_list" item="not_writeable"}
							<li>{$not_writeable}</li>
							{/foreach}
						</ul>
						{/if}
						
					</div>
				</div>
				{/if}
				<div class="app-template">
					<ul>
						{foreach name="$template_list" item="template" key="k"}
						<li {if condition="$template['use']==1"}class="selected"{/if} data-folder="{$template['folder']}"
							{if condition="$k>0 &&($k+1)%5==0"}style="margin-right:0;"{/if}>
							<div class="img">
								<img width="170" height="353" alt="template" src="__STATIC__/wap_template/img/{$template['preview']}">
							</div>
							<div class="advice">{$template['advice']}</div>
							<div class="name">{$template['theme']}</div>
						</li>
						{/foreach}
					</ul>
				</div>
		</dd>
	</dl>
	
</div>
<div id="bottom_div"></div>
<div class="btn-submit">
	<button class="edit_button" onclick="setConfigAjax();" style="margin: 12px auto;">提交</button>
</div>
{/block}

{block name="script"}

<script>
$(function(){
	chageshowblock();
})
function chageshowblock(){
	if($("#is_recommend").prop("checked")){
		$(".addblockbutton").show();
		$("#hideborder").show();
		$("#showblock").show();
	}else{
		$(".addblockbutton").hide();
		$("#hideborder").hide();
		$("#showblock").hide();
	}
	var is_recommend = 0;
	if($("#is_recommend").prop("checked")){
		is_recommend = 1;
	}
	//alert(is_recommend);return false;
	 $.ajax({
			type : "post",
			url : "{:__URL('ADMIN_MAIN/config/isrecommend')}",
			data : {
				'is_recommend' : is_recommend
			},
			success : function(data) {
				//alert(JSON.stringify(data));
				if (data['code'] > 0) {
					
				} else {
					showMessage('error',"提交失败");
				}
			}
		});
}

function chagecategoryblock(){
	var is_category = 0;
	if($("#is_category").prop("checked")){
		is_category = 1;
	}
	//alert(is_category);return false;
	 $.ajax({
			type : "post",
			url : "{:__URL('ADMIN_MAIN/config/iscategory')}",
			data : {
				'is_category' : is_category
			},
			success : function(data) {
				//alert(JSON.stringify(data));
				if (data['code'] > 0) {
					
				} else {
					showMessage('error',"提交失败");
				}
			}
		});
}
	
	
	
	

//改变商品分类触发事件
function changeCategory(event, level){
	var category_id = $(event).val();
	if(category_id == 0){
		$(event).parent().find(".category_second option:gt(0)").remove();
		$(event).parent().find(".category_three option:gt(0)").remove();
		return false;
	}
	if(level == 1){
		$(event).parent().find(".category_second").show(300);
		$(event).parent().find(".category_second option:gt(0)").remove();
		$(event).parent().find(".category_three option:gt(0)").remove();
		loadCategoryData(category_id, $(event).parent().find(".category_second"));
	}else if(level == 2){
		$(event).parent().find(".category_three").show(300);
		$(event).parent().find(".category_three option:gt(0)").remove();
		loadCategoryData(category_id, $(event).parent().find(".category_three"));
	}
}
// 加载数据
function loadCategoryData(category_id, obj){
	$.ajax({
		type : "post",
		url : "{:__URL('ADMIN_MAIN/system/getgoodscategorylistajax')}",
		data : {
			'category_id' : category_id,
		},
		async : true,
		success : function(data) {
			var html = '';
			if(data.length > 0){
				for(var i = 0; i < data.length; i++){
					html += '<option value="'+data[i]['category_id']+'">'+data[i]['category_name']+'</option>';
				}
			}
			$(obj).append(html);
		}
	});
}

$(".app-template li").click(function(){
	$(this).siblings("li").removeClass("selected");
	$(this).addClass("selected");
	$.ajax({
		type : "post",
		url :  "{:__URL('ADMIN_MAIN/Config/updateWapTemplateUse')}",
		data : { 'folder' : $(this).attr("data-folder") },
		success : function(res){
			if(res){
				showTip("操作成功","success");
			}else{
				showTip("操作失败","error");
			}
		}
	});
})

/*
 * 添加促销版块
 */
function addBlock(){
	$("#class_id").val(null);
	var num = $("#add-goodsRecommend").prev().find(".panel-heading").length;
	var show_type = "{$show_type}";
	//alert(num);
	//alert(show_type);
	if(show_type == 0){
		if(num >4){
			showMessage('error','模块最多只能添加5个！');
		}else{
			var html = '';
			html += '<div class="goodsRecommend" id="recommendAdd">';
			html += '<header class="panel-heading">促销商品推荐 <a href="javascript:void(0);" onclick="delGoodsRecommendClass(0,this)" class="handle"><i class="fa fa-trash-o"></i>&nbsp; 删除 </a>';
			html += '<a href="javascript:void(0);" data-toggle="data" onclick="updateGoodsRecommendClass(0)" class="handle" style="background:#01B044;"><i class="fa fa-cog"></i>&nbsp; 编辑 </a></header>';
			html += '<table class="table table-striped m-b-none text-sm"><tbody align="center">';
			html += '<tr>';
			html += '</tr></table></div>';
			$("#add-goodsRecommend").html(html);
		}
	}else{
		var html = '';
		html += '<div class="goodsRecommend" id="recommendAdd">';
		html += '<header class="panel-heading">促销商品推荐 <a href="javascript:void(0);" onclick="delGoodsRecommendClass(0,this)" class="handle"><i class="fa fa-trash-o"></i>&nbsp; 删除 </a>';
		html += '<a href="javascript:void(0);" data-toggle="data" onclick="updateGoodsRecommendClass(0)" class="handle" style="background:#01B044;"><i class="fa fa-cog"></i>&nbsp; 编辑 </a></header>';
		html += '<table class="table table-striped m-b-none text-sm"><tbody align="center">';
		html += '<tr>';
		html += '</tr></table></div>';
		$("#add-goodsRecommend").html(html);
	}
	
	
	
}
/*
 * 编辑促销版块
 */
function updateGoodsRecommendClass(class_id){
	$("#data").modal("show");
	if(class_id > 0){
		$.ajax({
			type : 'post',
			url : "{:__URL('ADMIN_MAIN/system/getgoodsrecommendclass')}",
			data : {'class_id' : class_id},
			async : true,
			success : function(data){
				$("#class_name").val(data['class_name']);
				$("#sort").val(data['sort']);
				$("#class_id").val(class_id);	
				goods_list_html = "";
	    		for(var i=0;i<data['goods_list'].length;i++){
					goods_list_html += '<div class="alert-goods-info" onDblClick="remove_selected_goods(this)">';
					goods_list_html += '<button type="button" class="close" data-dismiss="alert" style="color:#555;">×</button>';
					goods_list_html += '<input type="checkbox" name="selected_goods" value="'+data['goods_list'][i]['goods_id']+'" style="display:none;">';
					goods_list_html += '<img class="imglogo" src="__UPLOAD__/'+data['goods_list'][i]['picture_info']['pic_cover_small']+'" width="60" height="60">';
					goods_list_html += '<label  class="goods-name" title="'+data['goods_list'][i]['goods_info']['goods_name']+'">'+data['goods_list'][i]['goods_info']['goods_name']+'</label>';
					goods_list_html += '</div>';
					$('#goods_list').html(goods_list_html);
				}
			}
		})
	}else{
		$("#class_name").val('');
		$("#sort").val('');
		$("#class_id").val('');	
		$('#goods_list .alert-goods-info').remove();
	}
}
/*
 * 搜索商品
 */
function search_goods(){
	var goods_name = $("#search_info").val();
	if($("#category_three_id").val() > 0){
		var category_id = $("#category_three_id").val();
		var category_level = 3;
	}else if($("#category_second_id").val() > 0){
		var category_id = $("#category_second_id").val();
		var category_level = 2;
	}else{
		var category_id = $("#category_first_id").val();
		var category_level = 1;
	}
	$.ajax({
		type : 'post',
		url : "{:__URL('ADMIN_MAIN/system/searchgoods')}",
		data : {'goods_name':goods_name,'category_id':category_id, 'category_level':category_level},
		async : true,
		success : function(data){
			var html = '';
			if(data['data'].length > 0){
				for(var i=0;i<data['data'].length;i++){
					html += '<div class="search-goods-info" >';
					html += '<input type="checkbox" name="select_goods" value="'+data['data'][i]['goods_id']+'" style="display:none;">';
					html += '<img class="imglogo" src="__UPLOAD__/'+data['data'][i]['pic_cover_micro']+'"  onclick="addSelectGoods(this)" width="70" height="70">';
					html += '<label class="goods-name" title="'+data['data'][i]['goods_name']+'">'+data['data'][i]['goods_name']+'</label>';
					html += '</div>';
				}
			}else{
				html += '<div class="col-sm-12"><p>暂无商品</p></div>';
			}
			$("#search_goods_list").html(html);
		}
	})
}
/*
 * 向板块中添加商品
 */
function addSelectGoods(event){
	var goods_id_obj = $("#goods_list").find('input[name="selected_goods"]');
	var goods_id_str = '';
	for(var i=0; i<goods_id_obj.length; i++){ 
		goods_id_str += ','+goods_id_obj[i].value; //如果选中，将value添加到变量s中 
	} 
	var goods_id = $(event).parent('.search-goods-info').children('input[name="select_goods"]').val();
	var goods_url = $(event).attr("src");
	var goods_name = $(event).parent('.search-goods-info').children('label').html();
	//判断添加商品的个数
	var goods_list_obj = $("#goods_list").find('input[name="selected_goods"]');
	if(goods_list_obj.length<5){
		
	}else{
		return false;
	}
	if(goods_id_str.indexOf(goods_id) > 0){
		return false;
	}else{
		var html = '';
		html += '<div class="alert-goods-info" onDblClick="remove_selected_goods(this)">';
		html += '<button type="button" class="close" data-dismiss="alert" style="color:#555;">×</button>';
		html += '<input type="checkbox" name="selected_goods" value="'+goods_id+'" style="display:none;">';
		html += '<img class="imglogo" src="'+goods_url+'" width="60" height="60">';
		html += '<label  class="goods-name" title="'+goods_name+'">'+goods_name+'</label>';
		html += '</div>';
		$("#goods_list").append(html);
	}
}
// $("#class_name").keyup(function(){
// 	var class_name = $("#class_name").val();
// 	if(class_name == ''){
// 		$("#class_name").focus().next("span").show();
// 		return false;
// 	}else{
// 		$("#class_name").next("span").hide();
// 	}
// })
/*
 * 保存促销版块
 */
 function save(){
	var class_id = $("#class_id").val();
	var class_name = $("#class_name").val();
	//alert(class_name.length);
	var sort = $("#sort").val();
	var goods_id_obj = $("#goods_list").find('input[name="selected_goods"]');
	var goods_id_str = '';
	for(var i=0; i<goods_id_obj.length; i++){ 
		goods_id_str += ','+goods_id_obj[i].value; //如果选中，将value添加到变量s中 
	} 
	goods_id_str = goods_id_str.substr(1);
	if(class_name == ''){
		showMessage('error','版块名称不能为空！');
		$("#class_name").focus();
		return false;
	}
	var show_type = "{$show_type}";
	
	$.ajax({
		type: 'post',
		url: "{:__URL('ADMIN_MAIN/config/updategoodsrecommendclass')}",
		data: {'class_id':class_id,'class_name':class_name,'goods_id_str':goods_id_str,'sort':sort,'show_type':show_type},
		async: true,
		success:function(data){
			$("#data").modal("hide");
			if(data['code'] > 0){
				getPlatformGoodsRecommendClassInfo();
				//showMessage('success',data['message']);
			}else{
				showMessage('error',data['message']);
			}
		}
	});
}
 /**
  * 删除 促销版块
  */
 function delGoodsRecommendClass(class_id,e){
 	if(class_id > 0){
 		$( "#dialog" ).dialog({
 	        buttons: {
 	            "确定": function() {
 	                $(this).dialog('close');
 	                $.ajax({
 	    				type:"post",
 	    				url:"{:__URL('ADMIN_MAIN/config/delgoodsrecommendclass')}",
 	    				data:{'class_id':class_id},
 	    				async:true,
 	    				success:function (data) {
 	    					if(data['code'] > 0){
								showMessage('success',data['message'],"");
 	    						getPlatformGoodsRecommendClassInfo();
 	    					}else{
 	    						showMessage('error', data['message']);
 	    					}
 	    				}
 	    			});
 	            },
 	            "取消,#e57373": function() {
 	                $(this).dialog('close');
 	            }
 	        },
 	        contentText:"确定删除？",
 	    });
 	}else{
 		$(e).parents('#recommendAdd').remove()
 	}
 }
//双击 移除已选择的商品
function remove_selected_goods(event){
	$(event).remove();
}









function setConfigAjax(){
// 	alert($("#is_user").prop("checked"));
	var notice_message = $("#notice_message").val();
	var is_enable = 0;
	if($("#is_enable").prop("checked")){
		is_enable = 1;
	}
	if (notice_message == '') {
		$(".hint").show();
		$("#notice_message").focus();
		return false;
	} else {
		$(".hint").hide();
	}
	var is_category = 0;
	if($("#is_category").prop("checked")){
		is_category = 1;
	}
	$.ajax({
		type:"post",
		url:"{:__URL('ADMIN_MAIN/config/updatenotice')}",
		data:{
			'notice_message' : notice_message,
			'is_enable' : is_enable,
		},
		success:function (data) {
			//alert(JSON.stringify(data));
			if (data["code"] > 0) {
				showMessage('success', data["message"],"{:__URL('ADMIN_MAIN/config/fixedtemplate')}");
			}else{
				showMessage('error', data["message"]);
			}
		}
	});
}
//ajax记载促销
function getPlatformGoodsRecommendClassInfo(){
	$.ajax({
		type:"post",
		url:"{:__URL('ADMIN_MAIN/system/getPlatformGoodsRecommendClass')}",		
		success:function (data) {
			//alert(JSON.stringify(data));
			var html = '';
			if(data.length > 0 || data == undefined){
				html +='<div class="goodsRecommend" id="showblock" >';
				html +='<form class="" id="block_list">	';
				$.each(data,function(k,v){							
					html +='<header class="panel-heading">';
					html +=v['class_name']; 
					html +='<a href="javascript:void(0);" onclick="delGoodsRecommendClass('+v.class_id+',this)" class="handle"><i class="fa fa-trash-o"></i>&nbsp; 删除 </a>';   	
					html +='<a href="javascript:void(0);" onclick="updateGoodsRecommendClass('+v.class_id+')" class="handle" style="background:#01B044;"><i class="fa fa-cog"></i>&nbsp; 编辑 </a>';       	    	
					html +='</header>';
					html +='<div class="goods-logo-class">';
					html +='<ul>';
					if(v["goods_list"].length > 0 || v["goods_list"] == undefined){
						$.each(v["goods_list"],function(m,t){	
							 html +='<li >';
						 	 html +='<img class="imglogo" src="__UPLOAD__/'+t['picture_info']['pic_cover_small']+'" alt="'+t['goods_info']['goods_name']+'" title="'+t['goods_info']['goods_name']+'"  style="border:1px dashed #e9e9e9;text-align:center;">';
						 	 html +='</li>';
						})	
					}else{
					   html +='	<li>暂未选择商品</li>';
						
					}
				   html +='</ul>';
				   html +=' </div>';                     
				});
			    html +='</form>';
			    html +=' </div>';
				
			}else{
				html +='<div class="tip-box">当前系统还未设置促销板块，<a href="javascript:void(0);" onclick="addBlock()">马上设置</a></div>';      
			}
			$("#showblock").html(html);
			$("#add-goodsRecommend").html('');
		}
	});
	
}

$(function() {
	//var left = $(".ncsc-form-goods").offset().left;
	var width = $(".btn-submit").width();
//	var left = $(".btn-submit").offset().left;
	//浏览器窗口监听事件
	$(window).scroll(function() {
		var left = $(".main").offset().left;

		if($(window).height()+$(window).scrollTop()<$("#bottom_div").offset().top){
			$(".btn-submit").css({
				'position': 'fixed',
				'bottom': 0,
				'left': left,
				'z-index':10000,
				'width':width-30,
				"background-color":"rgba(204,204,204,0.7)",
				"margin":0,
				"padding":"0 15"
			});
		}else{
			$(".btn-submit").removeAttr("style");
		}
	});
})

</script>
{/block}


